package plus.easydo.easyuc.web.controller;

import cn.zhxu.bs.BeanSearcher;
import cn.zhxu.bs.SearchResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import plus.easydo.easyuc.core.vo.UcTenantVo;
import plus.easydo.easyuc.web.entity.UcTenant;
import plus.easydo.easyuc.web.service.UcTenantService;

import java.util.List;
import java.util.Map;

/**
 * @author yuzhanfeng
 * @Date 2023-10-07 15:17
 * @Description 租户管理
 */
@Tag(name = "租户管理")
@RestController
@RequiredArgsConstructor
@RequestMapping("/tenant")
public class TenantController {

    private final UcTenantService ucTenantService;


    @GetMapping("/m/list")
    @Operation(summary = "租户列表", description = "租户列表")
    public List<UcTenantVo> list(){
        List<UcTenantVo> list = ucTenantService.list();
        return list;
    }

    @PostMapping("/m/page")
    @Operation(summary = "租户分页查询", description = "租户分页查询")
    public SearchResult<UcTenant> page(@RequestBody Map<String,Object> queryParam){
        return ucTenantService.page(queryParam);
    }

}
